<?php
/**
 * Created by PhpStorm.
 * User: dust2
 * Date: 15-1-2
 * Time: 下午9:13
 */
class OrderProduct extends Eloquent
{
    protected $table = 'order_product';

    /**
     * 新增订单－商品关联
     * @param $productList
     * @param $order_id
     */
    public static function Tsinsert($productList, $order_id)
    {
        foreach ($productList as $item) {
            OrderProduct::insert([
                'order_id' => $order_id,
                'product_id' => $item['id'],
                'count' => $item['count'],
                'created_at' => date('Y-m-d h:m:s'),
                'updated_at' => date('Y-m-d h:m:s')
            ]);
        }
    }
}